{% extends 'base.html' %}
{% block title %}我的收藏{% endblock %}
{% block content %}
<div class="container mt-4">
    <h2>我的收藏</h2>
    {% if favorites %}
        <div class="list-group">
            {% for favorite in favorites %}
                <div class="list-group-item">
                    <div class="d-flex justify-content-between align-items-center">
                        <div>
                            <h5><a href="{{ url_for('post_detail', post_id=favorite.post.id) }}">{{ favorite.post.title }}</a></h5>
                            <small class="text-muted">
                                作者：{{ favorite.post.author.username or favorite.post.author.email }} | 
                                {{ favorite.post.created_at.strftime('%Y-%m-%d %H:%M') }}
                            </small>
                        </div>
                        <form method="post" action="{{ url_for('toggle_favorite', post_id=favorite.post.id) }}">
                            <button type="submit" class="btn btn-sm btn-outline-danger">取消收藏</button>
                        </form>
                    </div>
                </div>
            {% endfor %}
        </div>
    {% else %}
        <div class="alert alert-secondary mt-4">暂无收藏内容</div>
    {% endif %}
</div>
{% endblock %}
